<%@ page contentType="text/html;charset=utf-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>附件路径管理</title>
<meta name="decorator" content="default" />

<script type="text/javascript">
function newFramer(url) {
	popwin(url, 800, 1000, 1);
}
// open window
function popwin(url, width, height, resizable) {
	var Ttop = screen.availHeight / 2 - height / 2;
	var Tlef = screen.availWidth / 2 - width / 2;
	var feather = "width="
			+ width
			+ ", height="
			+ height
			+ ", fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable="
			+ resizable + ", top=" + Ttop + ",left=" + Tlef;
	window.open(url, "_blank", feather);
}

	$(function() {
		$(".update").css("display", "none");
		$(".update2").css("display", "none");
		$(".up").click(
				function() {
					$(this).parent("div").css("display", "none");
					$(this).parent("div").siblings(".update").css("display",
							"block");
					$(this).parent("div").parent("td").siblings("td").children(
							".show2").css("display", "none");
					$(this).parent("div").parent("td").siblings("td").children(
							".update2").css("display", "block");
				});
		$(".esc").click(
				function() {
					$(this).parent("div").siblings(".show").css("display",
							"block");
					$(this).parent(".update").css("display", "none");
					$(this).parent("div").parent("td").siblings("td").children(
							".show2").css("display", "block");
					$(this).parent("div").parent("td").siblings("td").children(
							".update2").css("display", "none");
				});
		$(".upd").click(
				function() {
					$(this).parent("div").parent("td").siblings("td").children(
					".update2").children("form").submit();
				});
	});
	
	function toUnicode(s){ 
        return s.replace(/([\u4E00-\u9FA5]|[\uFE30-\uFFA0])/g,function(newStr){
          return "\\u" + newStr.charCodeAt(0).toString(16); 
　　　　}); 
　　} 
	
	function chakan(di,iid,path){
		location = di+"/ta/stDynamicResource/down?iid="+iid+"&filename="+toUnicode(path);
	}
	

</script>

</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ta/stDynamicResource/">附件路径列表</a></li>
	</ul>
	<sys:message content="${message}" />
	<div style="float: left; padding-left: 10px; padding-bottom: 10px;">
		<input class="btn btn-primary" type="button"
			onclick="javascript:history.back(-1);" value="返回" />
	</div>
	<div style="float: right;">
		<a href="${ctx}/ta/stDynamicResource/upload?iid=${iid}">上传附件</a>
	</div>

	<fmt:requestEncoding value="GB2312" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>路径</th>
				<th>附件名称</th>
				<th>单个附件</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page}" var="stDynamicResource" varStatus="st">
				<tr>
					<td><a
						href="javascript:newFramer('${ctx}/ta/stAttachment/dsoframer?name=${stDynamicResource.path}&aid=${stDynamicResource.resValue}')">${stDynamicResource.iid}</a></td>
					<td>${stDynamicResource.sname}</td>
					<td><div class="show2">${stDynamicResource.path}</div>
						<div class="update2">
							<form action="${ctx}/ta/stDynamicResource/updateName"
								method="post" name="frm" id="frm">
								<input name="path" value="${stDynamicResource.path}" /> <input
									name="iid" type="hidden" value="${stDynamicResource.resValue}" />
								<input name="nid" type="hidden" value="${stDynamicResource.iid}" />
							</form>
						</div></td>
					<td><a
						href="javascript:chakan('${ctx}','${stDynamicResource.resValue}','${stDynamicResource.path}')">查看附件</a>
					</td>
					<td>
						<div align="center">
							<a
								href="${ctx}/ta/stDynamicResource/delOne?aid=${stDynamicResource.resValue}&nid=${stDynamicResource.iid}"
								onclick="return confirmx('确认要删除该附件路径吗？', this.href)">删除</a>
							<div class="show">
								<a href="#" class="up">改名</a>
							</div>
							<div class="update">
								<a href="#" class="upd">更新</a> <a href="#" class="esc">取消</a>
							</div>
						</div>
					</td>

				</tr>
			</c:forEach>
		</tbody>
	</table>

</body>
</html>